var count = 0

export const showLoading = () => {
  var dom = document.getElementById('loading-animation')
  if (!dom) {
    dom = document.createElement('div')
    dom.setAttribute('id', 'loading-animation')
    document.body.appendChild(dom)
  }
  count += 1
  dom.style.display = 'block'
}

export const hideLoading = () => {
  setTimeout(() => {
    count -= 1
    if (count <= 0) {
      var dom = document.getElementById('loading-animation')
      if (dom) {
        dom.style.display = 'none'
      }
    }
  }, 500)
}
